package com.guigu.www.tangyingmeng.controller;


import com.guigu.www.pojo.BespeakPoject;
import com.guigu.www.pojo.BespeakPojectType;
import com.guigu.www.pojo.PageVo;
import com.guigu.www.tangyingmeng.service.TymBespeakPojectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/poject")
public class TymBespeakPojectController {

    @Autowired
    private TymBespeakPojectService service;

    @PostMapping("/selpojectall")
    public PageVo<BespeakPoject> selpojectall(@RequestBody Map<String, String> map){
        PageVo<BespeakPoject> pageVo = service.selpojectall(map);
        return pageVo;
    }

    //查询所有项目类型
    @GetMapping("/selpojecttypeall")
    public List<BespeakPojectType> selpojecttypeall(){
        List<BespeakPojectType> list = service.selpojecttypeall();
        return list;
    }

    //根据项目编号查询项目的具体信息
    @GetMapping("/selpojectone/{id}")
    public BespeakPoject selpojectone(@PathVariable("id")String besproid){
        BespeakPoject poject = service.selpojectone(besproid);
        return poject;
    }

    //添加项目
    @PostMapping("/pojectadd")
    public Boolean pojectadd(@RequestBody BespeakPoject bespeakPoject){
        Boolean flag = service.pojectadd(bespeakPoject);
        return flag;
    }

    //修改项目
    @PostMapping("/pojectupdate")
    public Boolean pojectupdate(@RequestBody BespeakPoject bespeakPoject){
        Boolean flag = service.pojectupdate(bespeakPoject);
        return flag;
    }

    //删除项目
    //根据项目编号查询项目的具体信息
    @GetMapping("/delpoject/{id}")
    public Boolean delpoject(@PathVariable("id")String besproid){
        Boolean delpoject = service.delpoject(besproid);
        return delpoject;
    }

}
